package cn.gok.io;



import java.io.File;
import java.io.IOException;

/**
 * @ClassName File类
 * @Description TODO
 * @Author HP
 * @Date 14:31 2022/7/7
 * @Version 1.0
 **/
public class File类 {
    public static void showDir(File file){
        File file1[]=file.listFiles();
        for(File file2:file1){
            if(file2.isFile()) {
                System.out.println(file2.getAbsolutePath());
            }else if(file2.isDirectory()){
                showDir(file2);
                System.out.println(file2.getAbsolutePath());
            }
        }
    }
    public static int getSum(int n) {
        if (n==1){
            return 1;
        }
        return n+getSum(n-1);

    }
    public static void main(String[] args) throws IOException {
//        File file = new File("D:\\workspace_idea\\javase_project\\day4\\src\\cn\\gok\\io\\a1.txt");
//        System.out.println(file);
//        File file1 = new File("src/cn/gok/io","a1.txt");
//        System.out.println(file1);
//        File file2=new File("src/cn/gok/io");
//        File file3 = new File(file2,"a1.txt");
//
//        System.out.println("绝对路径"+file.getAbsolutePath());
//        System.out.println(file.getPath());
//        System.out.println(file.getName());
//        System.out.println(file.length());
//
//        if (!file.exists()){
//            System.out.println(file1.createNewFile());
//        }
//        System.out.println(file.isDirectory());
//        System.out.println(file.isFile());

    }


}
